package com.financing.platform.common;

import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.codehaus.jackson.map.annotate.JsonSerialize;

/**
 * @Title: ResultMap.java
 * @Package com.financing.platform.common
 * @Description: jsonp换回结果 
 * @author  qiye
 * @date 2014年12月1日 上午10:51:29
 * @version V1.0
 */
@JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
public class ResultMap  {
	
	protected Logger log = Logger.getLogger(this.getClass());
	
	public enum STATUS{
		SUCCESS,FAILE,ERROR,WARN,NEED_LOGIN
	}
	
	private String statusCode;
	/**
	 * 状态
	 */
	private STATUS status = STATUS.FAILE;
	
	/**
	 * 提示语
	 */
	private String message="";

	/**
	 * 返回结果
	 */
	private Map<String,Object> attribute = new HashMap<String,Object>();

	public STATUS getStatus() {
		return status;
	}

	public void setStatus(STATUS status) {
		this.status = status;
	}

	public Map<String, Object> getAttribute() {
		return attribute;
	}

	public void setAttribute(Map<String, Object> attribute) {
		this.attribute = attribute;
	}

	public String getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}
	
	public void setAttribute(String key,Object value){
		attribute.put(key, value);
	}
	
	public Object getAttribute(String key){
		return attribute.get(key);
	}
	
	public void putAll(Map<String,Object> object){
		attribute.putAll(object);
	}

	public String getMessage() {
		//在 info 和 Debug 才显示 错误提示语
		if(log.isDebugEnabled() || log.isInfoEnabled()){
			return message;
		}else{
			 return "";
		}
		
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
}

	